{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "https://leetcode.com/problems/palindromic-substrings\n",
    "\n",
    "\n",
    "Runtime: 1036 ms, faster than 5.03% of C++ online submissions for Palindromic Substrings.\n",
    "Memory Usage: 490.4 MB, less than 5.03% of C++ online submissions for Palindromic Substrings.\n",
    "\n",
    "\n",
    "```cpp\n",
    "class Solution\n",
    "{\n",
    "public:\n",
    "    int countSubstrings(string s)\n",
    "    {\n",
    "        int counting = 0;\n",
    "        vector<vector<char>> stringList;\n",
    "        for (int i = 0; i < s.size(); i++)\n",
    "        {\n",
    "            for (int j = 0; j + i  < s.size(); j++)\n",
    "            {\n",
    "                std::vector<char> subString{s.begin() + i, s.begin() + j + i + 1};\n",
    "                if (isPalindromic(subString))\n",
    "                {\n",
    "                    counting += 1;\n",
    "                }\n",
    "            }\n",
    "        }\n",
    "        return counting;\n",
    "    }\n",
    "\n",
    "    bool isPalindromic(vector<char> v)\n",
    "    {\n",
    "        int length = v.size();\n",
    "        int flag = 0;\n",
    "\n",
    "        for (int i = 0; i < length; i++)\n",
    "        {\n",
    "            if (v[i] != v[length - i - 1])\n",
    "            {\n",
    "                flag = 1;\n",
    "                break;\n",
    "            }\n",
    "        }\n",
    "        \n",
    "        if (flag) {\n",
    "            return false;\n",
    "        } else {\n",
    "            return true;\n",
    "        }\n",
    "    };\n",
    "};\n",
    "```"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {},
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "C++17",
   "language": "C++17",
   "name": "xcpp17"
  },
  "language_info": {
   "codemirror_mode": "text/x-c++src",
   "file_extension": ".cpp",
   "mimetype": "text/x-c++src",
   "name": "c++",
   "version": "17"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 4
}
